﻿#include <sdkddkver.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include <dxgi1_4.h>
#include <d3d12.h>

#include "../../../../Public/Graphic/Device/PTDevice.h"

#include "PTDeviceMemory.h"

#include "../../../../Public/System/PTExecutionSystem.h"
#include <assert.h>

class PTGraphicDeviceImpl : public IPTGraphicDevice
{
	void Destory(IPTHeap *pHeap) override;

	//Memory Management Strategies
	//http://msdn.microsoft.com/en-us/library/mt613239
	void MemoryInitialize(
		//Critical //Scaled/Optional //Streaming
		uint64_t SizeMaxAssetSRV,
		uint64_t SizeMaxAssetVBVIBV,
		//Re-used 
		uint64_t SizeMaxFrameRTVDSVSRV,
		uint64_t SizeMaxFrameUAVSRV,
		uint64_t SizeMaxFrameCBV,
		//Streaming 
		uint64_t SizeMaxStreamCPSC
	) override;

	IDXGIFactory4 *m_RenderMain_pDXGIFactory;
	ID3D12Device *m_RenderMain_pDevice;
	IPTHeap *m_StreamMain_pHeap;
	IPTDeviceMemory *m_StreamMain_pDeviceMemory;
	PTSocket m_RenderMain_hSocket;
	PTSocket m_StreamMain_hSocket;
	PTThread m_RenderMain_hThread;
	

	//DeviceExecutionImpl

	//DeviceMemoryImpl NUMA_NCC UMA_CC

	inline ~PTGraphicDeviceImpl();

public:
	inline PTGraphicDeviceImpl(
		IDXGIFactory4 *RenderMain_pDXGIFactory,
		ID3D12Device *RenderMain_pDevice)
		:
		m_RenderMain_pDXGIFactory(RenderMain_pDXGIFactory),
		m_RenderMain_pDevice(RenderMain_pDevice)
	{

	}

	inline void ExecutionInitialize();

	inline ID3D12Resource *AssertLoadDDS(const void *pSrcData);

};
